using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Authorization;
using MallSystembackend.Api.Model;
using MallSystembackend.Api.Repository;
using MallSystembackend.Api.ParamModel;

namespace MallSystembackend.Api.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class RolesController : ControllerBase
    {
        private IRepository<Roles> _rolesRepository;

        public RolesController(IRepository<Roles> rolesRepository){
            _rolesRepository = rolesRepository;
        }

        //获取角色列表
        [HttpGet]
        public ActionResult GetAllUsers(){

            var roles = _rolesRepository.Table.ToList();

            var role = roles.Where(x => x.IsDeleted==false).ToList();

            return Ok(new{
                Code = 1000,
                Data = role
            });

        }
    }

}